<?php

class Profile_Form_EditAvatar extends Zend_Form
{
	public function init()
	{
		parent::init();

        // Set the method for the display form to POST
		$this
			->setAction('')
			->setMethod('post')
			->setAttrib('enctype', 'multipart/form-data')
		;

		$elem = new Zend_Form_Element_File('profile_avatar');
		$elem
			->setLabel('Upload an image for avatar:')
		//	->setDestination(FILES_PATH .'/avatar')
			// ensure only 1 file
			->addValidator('Count', false, 1)
			// limit to 512K
			->addValidator('Size', false, 524288)
			// only JPEG, PNG, and GIFs
			->addValidator('Extension', false, 'jpeg,jpg,png,gif')
		;
		$this->addElement($elem);

        // Add the submit button
		$submit = new Zend_Form_Element_Submit('submit');
		$submit
			->setLabel('Save')
			->setIgnore(true)
			->setAttrib('class', 'submit')
		;
		$this->addElement($submit);
	}
}
